// Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
// This source file is part of the Cangjie project, licensed under Apache-2.0
// with Runtime Library Exception.
//
// See https://cangjie-lang.cn/pages/LICENSE for license information.

#ifndef CANGJIE_MIGRATOR_TOML_FILE
#define CANGJIE_MIGRATOR_TOML_FILE

#include <string>
#include <map>
#include <vector>
#include <memory>

#include "Path.h"

namespace CangjieMigrator {

struct TomlConfig {
    std::string title;
    std::map<std::string, std::string> pairs;

    explicit TomlConfig(std::string title);
    const std::string &operator[](std::string &&key) const;
};

class TomlFile {
public:
    TomlFile() = default;
    ~TomlFile() = default;

    bool ReadFile(const Path &filePath);
    bool ReadDirectory(const Path &directory);
    bool IsEmpty() const;

    std::vector<std::unique_ptr<TomlConfig>> configs;
};

} // namespace CangjieMigrator

#endif // CANGJIE_MIGRATOR_TOML_FILE
